package com.cecsmsserve.util;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

//配置自定义登录拦截器
@Configuration
public class JWTInterceptorConfig implements WebMvcConfigurer {

//    @Autowired
//    private LoginHandlerInterceptor loginHandlerInterceptor;
    @Resource
    private JWTInterceptor jwtInterceptor;

    //添加自定义的拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor)
                //loginInterceptor拦截器对所有url进行拦截
        .addPathPatterns("/**")
                //排除掉哪些url，也就是不拦截
        .excludePathPatterns("/user/**",
                           "/user/register",
                           "/user/login",
                           "/**/getVerificationCode/**",
                           "/**/image/**",
                           "/serviceType/selectChildren1ByFather/**",
                           "/api/dining/feedback/**",
                           "/serviceOrder/selectByUId/**",
                           "/serviceOrder/insert");
    }
}
